import random
shopping_list_name = [
    (0,"华为 mate40",10000),
    (1,"iphone12",9800),
    (2,"迪奥口红",300),
    (3,"坚果",70),
    (4,"牛奶",78)
]
aipay = int(input("请输入余额："))
user_shopping_list = []
while True:
    print("-----** 商品☆ -----")
    for item in shopping_list_name:
        print(shopping_list_name.index(item),item)
    user_chioce = input("请输入商品编号 (或者“退出”检查购物信息):")
    if user_choice.isdigit():
        user_chioce = int(user_choice)
        user_n = input("您要买几件呢？")
        if user_chioce >= 0 and user_chioce < len(shopping_list_name):
            if aipay>shopping_list_name[user_chioce][1]:
               user_shopping_list.append(shopping_list_name[user_chioce])
               money02 =aipay-shopping_list_name[user_chioce][1]
               print("以为您的添加该商品，您的余额不足还有%s" %(money02))
            else:
               print("您的余额不足,买不起")
        else:
            print("商品不存在")
    elif user_chioce == "退出":
         for item in user_shopping_list:
             print("您买了%s "%(item))
             print("您的余额还有%s(money02)")
             break
else:
    print("您输入的信息有误！")




